package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.Installment;
import org.iabako.shared.entity.business.Sale;
import org.iabako.shared.iservice.generic.CRUDServiceAsync;
import org.iabako.shared.iservice.generic.SearchServiceAsync;

import java.util.List;

/**
 * Created by jose on 02/09/14.
 */
public interface InstallmentServiceAsync extends SearchServiceAsync, CRUDServiceAsync {

    void getBySale(Sale entity, AsyncCallback<List<Installment>> async);

    void save(Installment installment, AsyncCallback<Installment> async);

    void remove(Installment installment, boolean noTrack, AsyncCallback<Boolean> async);

    void save(Installment installment, boolean noTrack, AsyncCallback<Installment> async);

    public static final class Util {
        private static InstallmentServiceAsync instance;

        public static final InstallmentServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(InstallmentService.class);
            }
            return instance;
        }
    }
}
